mod_rewrite - strange [R] behavior

Posted by Tal on Stack Overflow See other posts from Stack Overflow or by Tal
Published on 2010-06-16T21:49:44Z Indexed on 2010/06/16 21:52 UTC
Read the original article Hit count: 136

Hello!

I'm doing something very simple with mod_rewrite and it's behaving strange. It's behaving as if I'm using the [R] option, but I'm not. Here's a simple test for a .htaccess file:

RewriteEngine on
RewriteRule ^page1$ page2

This should redirect a request for page1 to page2, but leave the URL in the web browser still pointing to page1. That doesn't happen though. It actually switches the URL to page2, as if I were using this code:

RewriteRule ^page1$ page2 [R]

Why's it doing that? That's not the default behavior. I'm using a pre-configured machine I got for EC2, so it's probably something in the apache configuration I'm not aware of. Googling has been futile. Help?

This is Apache 2.12 btw.

© Stack Overflow or respective owner

Related posts about apache

Related posts about .htaccess